//路由管理
//导入vue-router
import { createRouter, createWebHistory } from 'vue-router'


//定义路由关系
const routes = [
    {
        path: '/',
        component: () => import("@/views/index.vue"), 
        redirect:"/article/category",//重定向到二级路由：分类
        //子路由
        children: [
            {
                path: "article/category",
                component: () => import("@/views/ArticleCategory.vue")
            }, {
                path: "article/manager",
                component: () => import("@/views/ArticleManager.vue")
            }, {
                path: "user/info",
                component: () => import("@/views/UserInfo.vue")
            }, {
                path: "user/pic",
                component: () => import("@/views/UserPic.vue")
            }, {
                path: "user/password",
                component: () => import("@/views/UserPassword.vue")
            }
        ]

    },
    {
        path: '/login',
        component: () => import("@/views/Login.vue")
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),//历史记录模式
    routes: routes//路由规则
});

export default router